package com.ukao.cashregister.adapter;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.BatchlTabBean;
import com.ukao.cashregister.bean.ClothIngManageBean;
import com.ukao.cashregister.utils.CheckUtils;
import com.ukao.cashregister.utils.ImageUtils;
import com.ukao.cashregister.utils.MyDateUtils;

import java.util.List;

import static android.icu.lang.UCharacter.GraphemeClusterBreak.V;
import static com.ukao.cashregister.R.id.selectCheckbox;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class BagListAdapter extends CommonAdapter< BatchlTabBean.ListBean> {



    public BagListAdapter(Context context, List< BatchlTabBean.ListBean> item) {
        super(context, item, R.layout.adapter_bag_list);
    }


    @Override
    public void convert(ViewHolder holder,BatchlTabBean.ListBean item) {

        TextView code = holder.getView(R.id.code);
        TextView productCnt = holder.getView(R.id.productCnt);
        ImageView selectCheckbox = holder.getView(R.id.selectCheckbox);
        code.setText(item.getCode());
        productCnt.setText((item.getProductCnt()+item.getAnnexCnt())+"");


        if(item.isCheck()){
            Drawable drawable= mContext.getResources().getDrawable(R.drawable.check_box_check);
            selectCheckbox.setImageDrawable(drawable);
            holder.itemView.setBackgroundResource(R.color.back_blue);
        }else{
            Drawable drawable=  mContext.getResources().getDrawable(R.drawable.check_box_normal);
            /// 这一步必须要做,否则不会显示.
            selectCheckbox.setImageDrawable(drawable);
            holder.itemView.setBackgroundResource(R.color.white);
        }







    }








}
